package textPixelId;

public class ClusterInfo implements Comparable<ClusterInfo>{
	public int r0, c0;	// top-left row, column of the enclosing box
	public int r1, c1;	// bottom-right row, column of the enclosing box
	
	public int cluster_idx;
	public int num_pixels;		// number of pixels in the cluster
	
	
	public ClusterInfo(int r0, int c0, int r1, int c1, int idx, int n) {
		this.r0 = r0;
		this.r1 = r1;
		this.c0 = c0;
		this.c1 = c1;
		
		cluster_idx = idx;
		num_pixels = n;
	}

	@Override
	public int compareTo(ClusterInfo o) {
		return o.num_pixels - num_pixels;
	}
	
	public String toString() {
		double pixelRatio = (double)num_pixels / ((r1-r0+1) * (c1-c0+1));
		return "["+r0+","+c0+"]-"+"["+r1+","+c1+"] pixels="+num_pixels+", idx="+cluster_idx + " " + pixelRatio;
	}
	
}
